-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Removing flag OperationInReleasingDataSource from DataGridView.cs #13362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing flag OperationInReleasingDataSource from DataGridView.cs #13362
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the handling of the OperationInReleasingDataSource flag and the subsequent cleanup of the DataGridView’s state when a bound data source is disposed. Key changes include removing the inline try–finally block that set the flag and reset CurrentCell from DataGridView.cs and moving that logic into a new dedicated method, OnDataSourceDisposed, in DataGridView.Methods.cs.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/System.Windows.Forms/System/Windows/Forms/Controls/DataGridView/DataGridView.cs | Removed the inline try–finally disposal block so that the flag and CurrentCell reset are handled by OnDataSourceDisposed. |
| src/System.Windows.Forms/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs | Added a new OnDataSourceDisposed method that wraps setting DataSource and resetting CurrentCell within a try–finally block. |
Comments suppressed due to low confidence (1)
src/System.Windows.Forms/System/Windows/Forms/Controls/DataGridView/DataGridView.cs:1922
- Verify that removing the inline try–finally block which sets _dataGridViewOper and resets CurrentCell does not affect any existing side effects in the property setter; ensure that all necessary state cleanup is now correctly handled by OnDataSourceDisposed.
- _dataGridViewOper[OperationInReleasingDataSource] = true;
src/System.Windows.Forms/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/System/Windows/Forms/Controls/DataGridView/DataGridView.cs
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #13362 +/- ##
====================================================
+ Coverage 62.59209% 95.69342% +33.10133%
====================================================
Files 1560 542 -1018
Lines 159763 63461 -96302
Branches 14915 1451 -13464
====================================================
- Hits 99999 60728 -39271
+ Misses 58988 2400 -56588
+ Partials 776 333 -443
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
4c202f0 to
f0546b8
Compare
c0ff14b to
31d5a9b
Compare
src/System.Windows.Forms/System/Windows/Forms/Controls/DataGridView/DataGridView.Methods.cs
Outdated
Show resolved
Hide resolved
|
PLease update the servicing PRs |
…sposed" (dotnet#13362) * Removing tag OperationInReleasingDataSource * Add judgment IsHandleCreated to before defining currentCell in function SetCurrentCellAddressCore
…sposed" (dotnet#13362) * Removing tag OperationInReleasingDataSource * Add judgment IsHandleCreated to before defining currentCell in function SetCurrentCellAddressCore
…sposed" (#13362) * Removing tag OperationInReleasingDataSource * Add judgment IsHandleCreated to before defining currentCell in function SetCurrentCellAddressCore
…sposed" (#13362) * Removing tag OperationInReleasingDataSource * Add judgment IsHandleCreated to before defining currentCell in function SetCurrentCellAddressCore
Fixes #13304
Proposed changes
This is a supplemental fix to PR Add _isReleasingDataSource to prevent unnecessary operations on CurrentCell when changing or releasing DataSource #13320
Add judgment
IsHandleCreatedbefore invokingEndEditto avoid the exceptionMicrosoft Reviewers: Open in CodeFlow